home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Information / Digests / CSMP Digest / volume 3 / csmp-digest-v3-072 / doubleCR.1 < prev   
Encoding:
Text File  |  1995-12-31  |  59.7 KB  |  1,831 lines

  1. C.S.M.P. Digest             Fri, 02 Dec 94       Volume 3 : Issue 72
  2.  
  3. Today's Topics:
  4.  
  5.         ADSP, PPC, Apple Events ? Which to use?
  6.         ASLM, CFM, etc
  7.         Background Only Apps
  8.         Call PostEvent() from a TimeMgr task!
  9.         OSACompile and OSAExecute
  10.         PBCatSearch finder flags?
  11.         Q: SICompletionUPP
  12.  
  13.  
  14.  
  15. The Comp.Sys.Mac.Programmer Digest is moderated by Francois Pottier
  16. (pottier@clipper.ens.fr).
  17.  
  18. The digest is a collection of article threads from the internet newsgroup
  19. comp.sys.mac.programmer.  It is designed for people who read c.s.m.p. semi-
  20. regularly and want an archive of the discussions.  If you don't know what a
  21. newsgroup is, you probably don't have access to it.  Ask your systems
  22. administrator(s) for details.  If you don't have access to news, you may
  23. still be able to post messages to the group by using a mail server like
  24. anon.penet.fi (mail help@anon.penet.fi for more information).
  25.  
  26. Each issue of the digest contains one or more sets of articles (called
  27. threads), with each set corresponding to a 'discussion' of a particular
  28. subject.  The articles are not edited; all articles included in this digest
  29. are in their original posted form (as received by our news server at
  30. nef.ens.fr).  Article threads are not added to the digest until the last
  31. article added to the thread is at least two weeks old (this is to ensure that
  32. the thread is dead before adding it to the digest).  Article threads that
  33. consist of only one message are generally not included in the digest.
  34.  
  35. The digest is officially distributed by two means, by email and ftp.
  36.  
  37. If you want to receive the digest by mail, send email to listserv@ens.fr
  38. with no subject and one of the following commands as body:
  39.     help                        Sends you a summary of commands
  40.     subscribe csmp-digest Your Name    Adds you to the mailing list
  41.     signoff csmp-digest            Removes you from the list
  42. Once you have subscribed, you will automatically receive each new
  43. issue as it is created.
  44.  
  45. The official ftp info is //ftp.dartmouth.edu/pub/csmp-digest.
  46. Questions related to the ftp site should be directed to
  47. scott.silver@dartmouth.edu. Currently no previous volumes of the CSMP
  48. digest are available there.
  49.  
  50. Also, the digests are available to WAIS users.  To search back issues
  51. with WAIS, use comp.sys.mac.programmer.src. With Mosaic, use
  52. http://www.wais.com/wais-dbs/comp.sys.mac.programmer.html.
  53.  
  54.  
  55. -------------------------------------------------------
  56.  
  57. >From gerrard@luga.latrobe.edu.au (Graeme Gerrard)
  58. Subject: ADSP, PPC, Apple Events ? Which to use?
  59. Date: Fri, 11 Nov 1994 13:51:40 GMT
  60. Organization: LaTrobe University
  61.  
  62. I need to send messages to a number
  63. of Macintoshes connected to a host over Localtalk.
  64.  
  65. The remote Macs will be running the *same program* continuously
  66. and different messages need to be sent to them.
  67. The messages are short, a couple of hundred bytes each
  68. and have to be sent every second or so.
  69. The main criteria is robustness.  The system has to run, with a minimum of
  70. maintenance, for several months.
  71.  
  72. Which is the best way to go, Apple Events, PPC toolbox, or a combination
  73. of NBP and ADSP?
  74.  
  75. Advice from anyone with experience in this kind of thing would be
  76. greatly appreciated.
  77.  
  78. -- 
  79. Graeme Gerrard                G.Gerrard@latrobe.edu.au
  80. Music Dept
  81. La Trobe University
  82.  
  83. +++++++++++++++++++++++++++
  84.  
  85. >From stevec@jolt.mpx.com.au (Stephen Coy)
  86. Date: Sun, 13 Nov 1994 00:23:28 +1100
  87. Organization: Resolve Software (WA) Pty Ltd
  88.  
  89. In article <gerrard-1211940051400001@131.172.10.162>,
  90. gerrard@luga.latrobe.edu.au (Graeme Gerrard) wrote:
  91.  
  92. > I need to send messages to a number
  93. > of Macintoshes connected to a host over Localtalk.
  94. > The remote Macs will be running the *same program* continuously
  95. > and different messages need to be sent to them.
  96. > The messages are short, a couple of hundred bytes each
  97. > and have to be sent every second or so.
  98. > The main criteria is robustness.  The system has to run, with a minimum of
  99. > maintenance, for several months.
  100. > Which is the best way to go, Apple Events, PPC toolbox, or a combination
  101. > of NBP and ADSP?
  102. > Advice from anyone with experience in this kind of thing would be
  103. > greatly appreciated.
  104.  
  105. Given the frequency of your messages, I would be inclined to build on top
  106. of the PPC toolbox. Combining this with the Threads Manager will allow
  107. your applications to function pseudo-asynchronously, independently of the
  108. Event Manager. The PPC toolbox provides functionality that you would have
  109. to build anyway if you were to build your own stuff on top of ADSP/NBP.
  110.  
  111. I suspect that the AppleEvent Manager would have trouble with the volume.
  112.  
  113. -- 
  114. Steve Coy
  115. Resolve Software (WA) Pty Ltd
  116. 4/69 Lynwood Ave
  117. Dee Why NSW 2099
  118. Australia
  119.  
  120. +++++++++++++++++++++++++++
  121.  
  122. >From h+@metrowerks.com (Jon W{tte)
  123. Date: Sun, 13 Nov 1994 11:16:47 +0100
  124. Organization: The Conspiracy
  125.  
  126. In article <gerrard-1211940051400001@131.172.10.162>,
  127. gerrard@luga.latrobe.edu.au (Graeme Gerrard) wrote:
  128.  
  129. >The main criteria is robustness.  The system has to run, with a minimum of
  130. >maintenance, for several months.
  131.  
  132. >Which is the best way to go, Apple Events, PPC toolbox, or a combination
  133. >of NBP and ADSP?
  134.  
  135. >Advice from anyone with experience in this kind of thing would be
  136. >greatly appreciated.
  137.  
  138. For the criteria mentioned, you can use any one of the methods. 
  139. NBP/ADSP is the most work, and the easiest on the network. 
  140. AppleEvents are much easier to code, but take more bandwidth. 
  141. PPC is just in the middle of them. I would use AppleEvents 
  142. because they're safe and easy to debug.
  143.  
  144. What worries me is this:
  145.  
  146. >I need to send messages to a number
  147. >of Macintoshes connected to a host over Localtalk.
  148. >The messages are short, a couple of hundred bytes each
  149. >and have to be sent every second or so.
  150.  
  151. LocalTalk has a MAXIMUM data throughput of 25 kB per second. 
  152. You have to divide by at least two, probably four, to get a 
  153. reliably sustainable data rate without too many collissions. 
  154. Two for the collission evasion on an ether media (not Ethernet, 
  155. but any CSMD media like LocalTalk), and two more for overhead 
  156. in protocols and replies. This gives you 6 kB/sec, or about 12 
  157. macs with 500 byte messages.
  158.  
  159. Max.
  160.  
  161. Cheers,
  162.  
  163.                     / h+
  164.  
  165.  
  166. --
  167.   Jon W‰tte (h+@nada.kth.se), Hagagatan 1, 113 48 Stockholm, Sweden
  168.  Santa's Reindeer: Fry 1 minced onion, add 1 lb thinly sliced frozen reindeer,
  169.  fry to color, add 1/2 lb mushrooms and 1/2 lb sour cream, simmer 5 mins, add
  170.  soy to taste, salt, pepper. Serve with boiled rice and redcurrant jelly.
  171.  
  172.  
  173. +++++++++++++++++++++++++++
  174.  
  175. >From pgontier@novell.com (Pete Gontier)
  176. Date: Mon, 14 Nov 1994 20:32:55 -0800
  177. Organization: Novell, Inc., Walnut Creek/Macintosh Site
  178.  
  179. In article <gerrard-1211940051400001@131.172.10.162>,
  180. gerrard@luga.latrobe.edu.au (Graeme Gerrard) wrote:
  181.  
  182. > I need to send messages to a number
  183. > of Macintoshes connected to a host over Localtalk.
  184. > ...The main criteria is robustness....
  185. > Which is the best way to go, Apple Events, PPC toolbox, or a combination
  186. > of NBP and ADSP?
  187.  
  188. Be aware that AppleEvents are based on PPC Toolbox, and PPC Toolbox is
  189. based on ADSP. You probably already knew this, but sometimes it's useful
  190. to hear it out loud. What it means is that no matter which of the three
  191. you pick, your choice will only be as robust as ADSP, but might be less
  192. robust. This might lead you to go with ADSP, if only to reduce the number
  193. of layers involved. However, PPC Toolbox does buy you quicker comm between
  194. processes on the same Mac, and AppleEvents buy you some amount of
  195. simplification, which might end up meaning that the least tested code,
  196. yours, is more robust.
  197.  
  198. -- 
  199.  The views expressed here do not necessarily reflect those of my employer.
  200.  
  201.  "Furthermore, in my mad haste to switch CDs, I dragged the Inside Mac CD-ROM 
  202.  icon to the trash and when the Mac ejected it, the tray pushed a glass of 
  203.  grape juice off my desk and into my lap. Let that be a lesson to 
  204.  development tool vendors: all this would have been avoided with better 
  205.  documentation." -- Miguel Cruz <mnc@netcom.com>
  206.  
  207. +++++++++++++++++++++++++++
  208.  
  209. >From bdiamand@netcom.com (Ben Diamand)
  210. Date: Wed, 16 Nov 1994 03:44:59 GMT
  211. Organization: NETCOM On-line Communication Services (408 261-4700 guest)
  212.  
  213. Pete Gontier (pgontier@novell.com) wrote:
  214. : In article <gerrard-1211940051400001@131.172.10.162>,
  215. : gerrard@luga.latrobe.edu.au (Graeme Gerrard) wrote:
  216.  
  217. : > I need to send messages to a number
  218. : > of Macintoshes connected to a host over Localtalk.
  219. : > 
  220. : > ...The main criteria is robustness....
  221. : > 
  222. : > Which is the best way to go, Apple Events, PPC toolbox, or a combination
  223. : > of NBP and ADSP?
  224.  
  225. : Be aware that AppleEvents are based on PPC Toolbox, and PPC Toolbox is
  226. : based on ADSP. You probably already knew this, but sometimes it's useful
  227. : to hear it out loud. What it means is that no matter which of the three
  228. : you pick, your choice will only be as robust as ADSP, but might be less
  229. : robust. This might lead you to go with ADSP, if only to reduce the number
  230. : of layers involved. However, PPC Toolbox does buy you quicker comm between
  231. : processes on the same Mac, and AppleEvents buy you some amount of
  232. : simplification, which might end up meaning that the least tested code,
  233. : yours, is more robust.
  234.  
  235. Also be aware that ADSP in built on top of DDP.  Now I know that ddp
  236. is lower level than most want to go, BUT, if you minimum overhead and
  237. still maintain compatability, you might consider DDP as an option.  One
  238. fault of DDP is that it's connection-less, meaning packets can be lost,
  239. so if you can't afford that, ADSP is the way to go...
  240.  
  241. Ben Diamand
  242. bdiamand@netcom.com
  243.  
  244.  
  245. +++++++++++++++++++++++++++
  246.  
  247. >From Chris Russo <chris@sonicsys.com>
  248. Date: 17 Nov 1994 01:56:47 GMT
  249. Organization: Sonic Systems, Inc.
  250.  
  251. In article <gerrard-1211940051400001@131.172.10.162> Graeme Gerrard,
  252. gerrard@luga.latrobe.edu.au writes:
  253. >I need to send messages to a number
  254. >of Macintoshes connected to a host over Localtalk.
  255. >
  256. >The remote Macs will be running the *same program* continuously
  257. >and different messages need to be sent to them.
  258. >The messages are short, a couple of hundred bytes each
  259. >and have to be sent every second or so.
  260. >The main criteria is robustness.  The system has to run, with a minimum of
  261. >maintenance, for several months.
  262. >
  263. >Which is the best way to go, Apple Events, PPC toolbox, or a combination
  264. >of NBP and ADSP?
  265. >
  266. >Advice from anyone with experience in this kind of thing would be
  267. >greatly appreciated.
  268.  
  269. Go with NBP and ADSP.
  270.  
  271. Anecdote*:  My office-mate wrote Server Sentry, a remote AppleShare admin,
  272. using AppleEvents - at first.  Unfortunately, he found that AppleEvents sent
  273. to a very busy machine can die without notifying the sender of the error.  He
  274. then took a step back to rely on the PPC toolbox.  Then, you still have to
  275. mess with program linking's dialogs since the PPC toolbox doesn't allow you to
  276. authenticate a user programmatically.  He ended up having to patch
  277. GetNewDialog() to hide Program Linking's password dialog offscreen while he
  278. stuffed the user's name and password into the dialog by posting the events. 
  279. Yuck.
  280.  
  281. Stick with ADSP.  It's a little nitty grittier, but simplicity of a protocol
  282. can have a lot of advantages.  Better to spend a little extra time getting
  283. started with a project because the building blocks are smaller than to start
  284. with a higher level protocol then get stuck mid-project because the protocol
  285. lacks some functionality.  Then you have to hack the hell out of the thing. 
  286. See the previous example.
  287.  
  288. Of course, you might not want to take my word for it.  I like to use DDP
  289. whenever I can. :-)
  290.  
  291. * Don't blame me for technical inaccuracies in this anecdote.  If necessary,
  292. I'll post the source of these complaints to avoid being flamed. :-)
  293.  
  294. Thanks,
  295.  
  296. - ------------------------------------------------------------------------
  297. Chris Russo                      Macintosh Programmer
  298. Sonic Systems, Inc.              (408) 736-1900 #107
  299. chris@sonicsys.com               I'm tired of my signature.
  300.  
  301. +++++++++++++++++++++++++++
  302.  
  303. >From bdiamand@netcom.com (Ben Diamand)
  304. Date: Wed, 16 Nov 1994 03:44:59 GMT
  305. Organization: NETCOM On-line Communication Services (408 261-4700 guest)
  306.  
  307. Pete Gontier (pgontier@novell.com) wrote:
  308. : In article <gerrard-1211940051400001@131.172.10.162>,
  309. : gerrard@luga.latrobe.edu.au (Graeme Gerrard) wrote:
  310.  
  311. : > I need to send messages to a number
  312. : > of Macintoshes connected to a host over Localtalk.
  313. : > 
  314. : > ...The main criteria is robustness....
  315. : > 
  316. : > Which is the best way to go, Apple Events, PPC toolbox, or a combination
  317. : > of NBP and ADSP?
  318.  
  319. : Be aware that AppleEvents are based on PPC Toolbox, and PPC Toolbox is
  320. : based on ADSP. You probably already knew this, but sometimes it's useful
  321. : to hear it out loud. What it means is that no matter which of the three
  322. : you pick, your choice will only be as robust as ADSP, but might be less
  323. : robust. This might lead you to go with ADSP, if only to reduce the number
  324. : of layers involved. However, PPC Toolbox does buy you quicker comm between
  325. : processes on the same Mac, and AppleEvents buy you some amount of
  326. : simplification, which might end up meaning that the least tested code,
  327. : yours, is more robust.
  328.  
  329. Also be aware that ADSP in built on top of DDP.  Now I know that ddp
  330. is lower level than most want to go, BUT, if you minimum overhead and
  331. still maintain compatability, you might consider DDP as an option.  One
  332. fault of DDP is that it's connection-less, meaning packets can be lost,
  333. so if you can't afford that, ADSP is the way to go...
  334.  
  335. Ben Diamand
  336. bdiamand@netcom.com
  337.  
  338.  
  339. +++++++++++++++++++++++++++
  340.  
  341. >From bdiamand@netcom.com (Ben Diamand)
  342. Date: Wed, 16 Nov 1994 03:44:59 GMT
  343. Organization: NETCOM On-line Communication Services (408 261-4700 guest)
  344.  
  345. Pete Gontier (pgontier@novell.com) wrote:
  346. : In article <gerrard-1211940051400001@131.172.10.162>,
  347. : gerrard@luga.latrobe.edu.au (Graeme Gerrard) wrote:
  348.  
  349. : > I need to send messages to a number
  350. : > of Macintoshes connected to a host over Localtalk.
  351. : > 
  352. : > ...The main criteria is robustness....
  353. : > 
  354. : > Which is the best way to go, Apple Events, PPC toolbox, or a combination
  355. : > of NBP and ADSP?
  356.  
  357. : Be aware that AppleEvents are based on PPC Toolbox, and PPC Toolbox is
  358. : based on ADSP. You probably already knew this, but sometimes it's useful
  359. : to hear it out loud. What it means is that no matter which of the three
  360. : you pick, your choice will only be as robust as ADSP, but might be less
  361. : robust. This might lead you to go with ADSP, if only to reduce the number
  362. : of layers involved. However, PPC Toolbox does buy you quicker comm between
  363. : processes on the same Mac, and AppleEvents buy you some amount of
  364. : simplification, which might end up meaning that the least tested code,
  365. : yours, is more robust.
  366.  
  367. Also be aware that ADSP in built on top of DDP.  Now I know that ddp
  368. is lower level than most want to go, BUT, if you minimum overhead and
  369. still maintain compatability, you might consider DDP as an option.  One
  370. fault of DDP is that it's connection-less, meaning packets can be lost,
  371. so if you can't afford that, ADSP is the way to go...
  372.  
  373. Ben Diamand
  374. bdiamand@netcom.com
  375.  
  376.  
  377. +++++++++++++++++++++++++++
  378.  
  379. >From Chris Russo <chris@sonicsys.com>
  380. Date: 17 Nov 1994 01:56:47 GMT
  381. Organization: Sonic Systems, Inc.
  382.  
  383. In article <gerrard-1211940051400001@131.172.10.162> Graeme Gerrard,
  384. gerrard@luga.latrobe.edu.au writes:
  385. >I need to send messages to a number
  386. >of Macintoshes connected to a host over Localtalk.
  387. >
  388. >The remote Macs will be running the *same program* continuously
  389. >and different messages need to be sent to them.
  390. >The messages are short, a couple of hundred bytes each
  391. >and have to be sent every second or so.
  392. >The main criteria is robustness.  The system has to run, with a minimum of
  393. >maintenance, for several months.
  394. >
  395. >Which is the best way to go, Apple Events, PPC toolbox, or a combination
  396. >of NBP and ADSP?
  397. >
  398. >Advice from anyone with experience in this kind of thing would be
  399. >greatly appreciated.
  400.  
  401. Go with NBP and ADSP.
  402.  
  403. Anecdote*:  My office-mate wrote Server Sentry, a remote AppleShare admin,
  404. using AppleEvents - at first.  Unfortunately, he found that AppleEvents sent
  405. to a very busy machine can die without notifying the sender of the error.  He
  406. then took a step back to rely on the PPC toolbox.  Then, you still have to
  407. mess with program linking's dialogs since the PPC toolbox doesn't allow you to
  408. authenticate a user programmatically.  He ended up having to patch
  409. GetNewDialog() to hide Program Linking's password dialog offscreen while he
  410. stuffed the user's name and password into the dialog by posting the events. 
  411. Yuck.
  412.  
  413. Stick with ADSP.  It's a little nitty grittier, but simplicity of a protocol
  414. can have a lot of advantages.  Better to spend a little extra time getting
  415. started with a project because the building blocks are smaller than to start
  416. with a higher level protocol then get stuck mid-project because the protocol
  417. lacks some functionality.  Then you have to hack the hell out of the thing. 
  418. See the previous example.
  419.  
  420. Of course, you might not want to take my word for it.  I like to use DDP
  421. whenever I can. :-)
  422.  
  423. * Don't blame me for technical inaccuracies in this anecdote.  If necessary,
  424. I'll post the source of these complaints to avoid being flamed. :-)
  425.  
  426. Thanks,
  427.  
  428. - ------------------------------------------------------------------------
  429. Chris Russo                      Macintosh Programmer
  430. Sonic Systems, Inc.              (408) 736-1900 #107
  431. chris@sonicsys.com               I'm tired of my signature.
  432.  
  433. +++++++++++++++++++++++++++
  434.  
  435. >From pjd@triassic.midnight.com (Peter Desnoyers)
  436. Date: 18 Nov 94 15:06:14
  437. Organization: Midnight Networks Inc., Waltham MA
  438.  
  439. In article <AAEBA61F96683F2D@klkmac006.nada.kth.se> h+@metrowerks.com (Jon W{tte) writes:
  440.  >
  441.  >LocalTalk has a MAXIMUM data throughput of 25 kB per second. 
  442.  >You have to divide by at least two, probably four, to get a 
  443.  >reliably sustainable data rate without too many collissions. 
  444.  >Two for the collission evasion on an ether media (not Ethernet, 
  445.  >but any CSMD media like LocalTalk), and two more for overhead 
  446.  >in protocols and replies. This gives you 6 kB/sec, or about 12 
  447.  >macs with 500 byte messages.
  448.  
  449. You might want to go back and check your math on that one.
  450.  
  451. Localtalk is actually quite efficient - if you send max size packets
  452. on a loaded net, you will have 400us of inter-frame gap, followed by
  453. an average of 6 RTS transmissions (actually 2e) until one is ACKed
  454. successfully, at 200us each, followed by 20 ms of data. That's an
  455. efficiency of about 93%. (not counting framing and protocol overhead).
  456. Overhead goes up with smaller packets, but you could still get about
  457. 80% efficiency with 200-byte packets.
  458.  
  459. [also, the max data rate on LocalTalk is 230kb/8 = ~29kbyte/sec.]
  460.  
  461. As far as higher-layer protocol overhead goes, 2x seems like an overly
  462. high estimate, but with the right protocol I'm sure you could make it
  463. even worse than that.
  464.  
  465. ...............................................................................
  466.   Peter Desnoyers  : Midnight Networks Inc. 200 Fifth Avenue Waltham MA 02154 
  467.   pjd@midnight.com : Vox 617/890-1001 Fax -0028  The Best in Network Software
  468. --
  469.  
  470.  
  471. ...............................................................................
  472.   Peter Desnoyers  : Midnight Networks Inc. 200 Fifth Avenue Waltham MA 02154 
  473.   pjd@midnight.com : Vox 617/890-1001 Fax -0028  The Best in Network Software
  474.  
  475.  
  476. ---------------------------
  477.  
  478. >From erik@lexmark.com (Erik Ackerman)
  479. Subject: ASLM, CFM, etc
  480. Date: Wed, 16 Nov 1994 18:14:57 GMT
  481. Organization: AiC
  482.  
  483. I am working on a rewrite of an application that would greatly benefit from
  484. being "plugable".  I have been aiming for a code resource spec, but
  485. recently began to consider using ASLM or CFM (need to support 68K).  Does
  486. anyone have any recomendations as to what solution would be best?  Which
  487. will have the greatest longevity and/or support?  etc...
  488.  
  489. Thanks in advance.
  490.  
  491. Erik Ackerman
  492.  
  493. -- 
  494. erik@lexmark.com
  495.  
  496. Q: What is the difference between a duck?
  497. A: One of its legs is both the same.
  498.  
  499. +++++++++++++++++++++++++++
  500.  
  501. >From untulis@netcom.com (Jason Untulis)
  502. Date: Wed, 16 Nov 1994 20:12:22 GMT
  503. Organization: NETCOM On-line Communication Services (408 261-4700 guest)
  504.  
  505. Erik Ackerman (erik@lexmark.com) wrote:
  506. : I am working on a rewrite of an application that would greatly benefit from
  507. : being "plugable".  I have been aiming for a code resource spec, but
  508. : recently began to consider using ASLM or CFM (need to support 68K).  Does
  509. : anyone have any recomendations as to what solution would be best?  Which
  510. : will have the greatest longevity and/or support?  etc...
  511.  
  512. >From what I've read, CFM would be your best bet. ASLM is dependent on
  513. cfront C++-style name mangling, whereas CFM should work with any language.
  514. CFM alread exists on PPC, with the beta 68K CFM coming with the OpenDoc
  515. beta which is scheduled for January. I would think that CFM is the
  516. thing that will ge the most support from Apple.
  517. -- 
  518. - -----
  519. #include <std/disclaimer>           (C) 1994. All rights reserved.
  520. Jason Untulis        untulis@ (netcom.com) (tower.tandem.com)
  521.             untulis_jason@tandem.com, jason@hplcau.hpl.hp.com
  522.    "You don't want to upset the dinosaurs, do you?" -- CompuServe ad
  523.  
  524. +++++++++++++++++++++++++++
  525.  
  526. >From afcjlloyd@aol.com (AFC JLloyd)
  527. Date: 17 Nov 1994 16:20:06 -0500
  528. Organization: America Online, Inc. (1-800-827-6364)
  529.  
  530. In article <erik-161194131457@c21mac4.pfv.prtdev.lexmark.com>,
  531. erik@lexmark.com (Erik Ackerman) writes:
  532.  
  533. >I am working on a rewrite of an application that would greatly benefit
  534. from
  535. >being "plugable".  I have been aiming for a code resource spec, but
  536. >recently began to consider using ASLM or CFM (need to support 68K).  Does
  537. >anyone have any recomendations as to what solution would be best?  Which
  538. >will have the greatest longevity and/or support?  etc...
  539.  
  540. The answer probably depends upon other requirements.  Do you require C++? 
  541. Do you require the ability to develop your "plugs" with several different
  542. compilers?
  543.  
  544. If you require C++, then you should either use ASLM, which limits the
  545. compilers you can use, or you should use SOM on top of CFM.  If you don't
  546. require C++, then straight CFM is probably your best choice.  If you try
  547. to use C++ on CFM you'll probably be forced to use a single compiler, and
  548. you'll have to worry about the "fragile base class" problem.
  549.  
  550. If you use SOM, then you'll (in theory) be able to write plugs in multiple
  551. languages/compilers, and the fragile base class problem is almost
  552. completely solved.  SOM language bindings for C and C++ are available now,
  553. and other languages will probably be supported in the future.  Note that
  554. the SOM object model is very similar to Object Pascal's object model, so
  555. you give up some of the features of C++, e.g. no stack-based objects (but
  556. you can have multiple inheritance).  Also note that you can use SOM for
  557. your exported interface, but internally use all the features C++ if you so
  558. choose.
  559.  
  560. By the way, OpenDoc is being built with SOM/CFM.  One question you should
  561. answer is: can your application be built using OpenDoc?
  562.  
  563. Jim Lloyd
  564. afcjlloyd@aol.com
  565.  
  566. +++++++++++++++++++++++++++
  567.  
  568. >From mattm@apple.com (Matthew Melmon)
  569. Date: Thu, 17 Nov 1994 20:28:53 GMT
  570. Organization: Cabal Noir:  Glorious Leader
  571.  
  572. In article <untulisCzDMsn.Ir4@netcom.com>, untulis@netcom.com (Jason
  573. Untulis) wrote:
  574.  
  575. > Erik Ackerman (erik@lexmark.com) wrote:
  576. > : I am working on a rewrite of an application that would greatly benefit from
  577. > : being "plugable".  I have been aiming for a code resource spec, but
  578. > : recently began to consider using ASLM or CFM (need to support 68K).  Does
  579. > : anyone have any recomendations as to what solution would be best?  Which
  580. > : will have the greatest longevity and/or support?  etc...
  581. > From what I've read, CFM would be your best bet. ASLM is dependent on
  582. > cfront C++-style name mangling, whereas CFM should work with any language.
  583. > CFM alread exists on PPC, with the beta 68K CFM coming with the OpenDoc
  584. > beta which is scheduled for January. I would think that CFM is the
  585. > thing that will ge the most support from Apple.
  586.  
  587. A really, really, really close-to-beta (RRRCtB) of CFM-68K will be
  588. shipping on ETO 16, in a matter of weeks, now, I suppose.
  589.  
  590. -- 
  591. *X*
  592.  
  593. ---------------------------
  594.  
  595. >From ctaylor@fox.nstn.ns.ca (Christian Taylor)
  596. Subject: Background Only Apps
  597. Date: 7 Nov 1994 16:45:24 -0400
  598. Organization: Nova Scotia Technology Network
  599.  
  600. Could someone please send me some sample source code of a background only
  601. app in Pascal?  (THINK Pascal actually).  Everytime I try to make a
  602. program background only, the Mac crashes whenever I click in the
  603. Application menu!  And yes, I've read the Tech Note from ftp.apple.com on
  604. BOAs.  Thanks!
  605.  
  606. Christian
  607.  
  608. +++++++++++++++++++++++++++
  609.  
  610. >From williar2@miavx1.acs.muohio.edu (Bob Williams)
  611. Date: 7 Nov 94 19:34:03 -0500
  612. Organization: Enterprise Software
  613.  
  614. In article <ctaylor-0711941646450001@wolfville-ts-15.nstn.ca>, ctaylor@fox.nstn.ns.ca (Christian Taylor) writes:
  615. > Could someone please send me some sample source code of a background only
  616. > app in Pascal?  (THINK Pascal actually).  Everytime I try to make a
  617. > program background only, the Mac crashes whenever I click in the
  618. > Application menu!  And yes, I've read the Tech Note from ftp.apple.com on
  619. > BOAs.  Thanks!
  620. > Christian
  621.  
  622. Me too!!! I have the exact same problem. I posted here once before, but noone
  623. answered. I would greatly appreciate it. Thanks!!!
  624.  
  625. Regards,
  626. Bob
  627. -- 
  628. +------------------------------------------------------+
  629. |  Robert E. Williams, Jr.                             |
  630. |  Enterprise Software                                 |
  631. |  2006 State Route 380                                |
  632. |  Wilmington, Ohio  45177-9241                        |
  633. |  (513) 382-8232                                      |
  634. |                                                      |
  635. |  E-mail: williar2@miavx1.acs.muohio.edu              |
  636. +------------------------------------------------------+
  637. |   Those who are patient in the trivial things in     |
  638. |   life and control themselves will one day have the  |
  639. |   same mastery in great and important things.        |
  640. |      --Hapkido Master Bong Soo Han                   |
  641. +------------------------------------------------------+
  642.  
  643. +++++++++++++++++++++++++++
  644.  
  645. >From chris-b@cs.auckland.ac.nz (Chris Burns)
  646. Date: Tue, 08 Nov 1994 22:23:24 +1200
  647. Organization: AucklandUniversity:ComputerScience:HMU
  648.  
  649. In article <1994Nov7.193403.33348@miavx1>, williar2@miavx1.acs.muohio.edu
  650. (Bob Williams) wrote:
  651.  
  652. > In article <ctaylor-0711941646450001@wolfville-ts-15.nstn.ca>,
  653. ctaylor@fox.nstn.ns.ca (Christian Taylor) writes:
  654.  
  655. > > Could someone please send me some sample source code of a background only
  656. > > app in Pascal?  (THINK Pascal actually).  Everytime I try to make a
  657. > > program background only, the Mac crashes whenever I click in the
  658. > > Application menu!  And yes, I've read the Tech Note from ftp.apple.com on
  659. > > BOAs.  Thanks!
  660. > Me too!!! I have the exact same problem. I posted here once before, but noone
  661. > answered. I would greatly appreciate it. Thanks!!!
  662.  
  663. THINK Pascal automagically places standard toolbox initialization code at
  664. the beginning of your app. You need to turn this feature off for BOAs by
  665. placing a {$I-} near the top of your main program file. You also need a
  666. _MaxApplZone call (expands heap to fullest), an _InitGraf call (sets up
  667. your app A5 world) and a few _MoreMasters (to preallocate a few master
  668. pointer blocks). Your code goes after this stuff.
  669.  
  670. {-------------------------}
  671. {$I-}
  672.  
  673. program blah;
  674.  
  675. begin
  676.   MaxApplZone;
  677.   InitGraf(@thePort);
  678.  
  679.   MoreMasters;
  680.   MoreMasters;
  681.   MoreMasters;
  682.  
  683.  
  684.  
  685.  
  686.  
  687. end.
  688.  
  689. {-------------------------}
  690.  
  691. Chris B
  692. - ---------------------------------------------------------------------
  693. NewZealand:AucklandUniversity:ComputerScience:HyperMediaUnit:ChrisBurns
  694. Internet: chris-b@cs.auckland.ac.nz
  695. Phone:    +64 9 373-7599 x6194
  696. Fax:      +64 9 373-7453                         Async, therefore I am.
  697. - ---------------------------------------------------------------------
  698.  
  699. +++++++++++++++++++++++++++
  700.  
  701. >From asunta@convex.csc.FI (Miika Asunta)
  702. Date: 12 Nov 1994 17:08:43 GMT
  703. Organization: Sibelius Academy, Helsinki
  704.  
  705. In <1994Nov7.193403.33348@miavx1> williar2@miavx1.acs.muohio.edu (Bob Williams) writes:
  706.  
  707. >In article <ctaylor-0711941646450001@wolfville-ts-15.nstn.ca>, ctaylor@fox.nstn.ns.ca (Christian Taylor) writes:
  708. >> Could someone please send me some sample source code of a background only
  709. >> app in Pascal?  (THINK Pascal actually).  Everytime I try to make a
  710. >> program background only, the Mac crashes whenever I click in the
  711. >> Application menu!  And yes, I've read the Tech Note from ftp.apple.com on
  712. >> BOAs.  Thanks!
  713. >> 
  714.  
  715. I'm sorry this in in C, but I believe you can read it anyway.
  716. The projet type must be 'appe' for background application (NOT
  717. 'APPL'). In addition, set 'Only background' size option.
  718.  
  719. Since 'appe' is only background application, don't call usual
  720. toolbox-init routines. You must not use WindowManager, Menu manager
  721. etc. 
  722.  
  723. The following example misses MyQUIT() routine, an apple-event handler,
  724. that you should be able to write yourself.
  725.  
  726. That application waits quit-apple event forever, and it doesn't eat
  727. system time at all (-:
  728.  
  729. //----------------------------------------------------------
  730.  
  731. void HandleEvents(void)
  732. {
  733. WaitNextEvent(highLevelEventMask,&Event,-1L,NULL);
  734. switch(Event.what) {
  735. case kHighLevelEvent:AEProcessAppleEvent(&Event);break;
  736. }}
  737.  
  738.  
  739.  
  740. main()
  741. {
  742. MaxApplZone();
  743. MoreMasters();
  744.  
  745. AEInstallEventHandler(kCoreEventClass,kAEQuitApplication,&myQUIT,0L,0);
  746.  
  747. idletime=-1L;
  748.  
  749. do HandleEvents();
  750. while (!lopetus);
  751. }
  752.  
  753.  
  754. //------------------------------------------------------------------------
  755. --
  756. Miika Asunta
  757. asunta@convex.csc.fi            Double Bass Player
  758. tel. +358-31-255 9461            Macintosh Programmer
  759.  
  760. +++++++++++++++++++++++++++
  761.  
  762. >From chris-b@cs.auckland.ac.nz (Chris Burns)
  763. Date: Sun, 13 Nov 1994 23:07:59 +1200
  764. Organization: AucklandUniversity:ComputerScience:HMU
  765.  
  766. In article <3a2sqr$pla@pobox.csc.fi>, asunta@convex.csc.FI (Miika Asunta) wrote:
  767.  
  768. > void HandleEvents(void)
  769. > {
  770. > WaitNextEvent(highLevelEventMask,&Event,-1L,NULL);
  771. > switch(Event.what) {
  772. > case kHighLevelEvent:AEProcessAppleEvent(&Event);break;
  773. > }}
  774. > main()
  775. > {
  776. > MaxApplZone();
  777. > MoreMasters();
  778. > AEInstallEventHandler(kCoreEventClass,kAEQuitApplication,&myQUIT,0L,0);
  779. > idletime=-1L;
  780. > do HandleEvents();
  781. > while (!lopetus);
  782. > }
  783.  
  784. You really should do an:
  785.  
  786. InitGraf(&qd.thePort); // Metrowerks C/C++
  787.  
  788. or
  789.  
  790. InitGraf(&thePort); // Symantec C++
  791.  
  792. or 
  793.  
  794. InitGraf(@thePort); // THINK Pascal
  795.  
  796. after the calls to MaxApplZone() and MoreMasters(). This sets up the A5
  797. world necessary for WNE and context switching.
  798.  
  799. Chris B
  800. - ---------------------------------------------------------------------
  801. NewZealand:AucklandUniversity:ComputerScience:HyperMediaUnit:ChrisBurns
  802. Internet: chris-b@cs.auckland.ac.nz
  803. Phone:    +64 9 373-7599 x6194
  804. Fax:      +64 9 373-7453                         Async, therefore I am.
  805. - ---------------------------------------------------------------------
  806.  
  807. +++++++++++++++++++++++++++
  808.  
  809. >From jbobier@cybernetics.net (Jason Bobier)
  810. Date: Mon, 14 Nov 1994 09:12:45 -0500
  811. Organization: Prismatix Software
  812.  
  813.  
  814. Whoops... couple of problems with this...
  815.  
  816. In article <3a2sqr$pla@pobox.csc.fi>, asunta@convex.csc.FI (Miika Asunta) wrote:
  817. > I'm sorry this in in C, but I believe you can read it anyway.
  818. > The projet type must be 'appe' for background application (NOT
  819. > 'APPL'). In addition, set 'Only background' size option.
  820.  
  821. FBA's can have a type of 'APPL' and can be launched at anytime. If the
  822. type is 'appe' they will be put in the extensions folder and launched
  823. automatically at startup if dragged to the system folder.
  824.  
  825. > main()
  826. > {
  827. > MaxApplZone();
  828. > MoreMasters();
  829.  
  830. // Add the following
  831.    InitGraf(@qd.thePort);
  832.  
  833. > AEInstallEventHandler(kCoreEventClass,kAEQuitApplication,&myQUIT,0L,0);
  834. > idletime=-1L;
  835. > do HandleEvents();
  836. > while (!lopetus);
  837. > }
  838.  
  839. Jason
  840.  
  841. _____________________________________________________________________
  842. Jason A. Bobier
  843. Prismatix Software
  844.  
  845. Email: jbobier@cybernetics.net
  846.  
  847. "Living is easy with eyes closed..."  - The Beatles
  848.  
  849. +++++++++++++++++++++++++++
  850.  
  851. >From jbobier@cybernetics.net (Jason Bobier)
  852. Date: Mon, 14 Nov 1994 09:26:44 -0500
  853. Organization: Prismatix Software
  854.  
  855. In article <jbobier-1411940912450001@bobier.cybernetics.net>,
  856. jbobier@cybernetics.net (Jason Bobier) wrote:
  857.  
  858. > Whoops... couple of problems with this...
  859. Whoops... Late night with Macsbug...
  860.  
  861. > > main()
  862. > > {
  863. > > MaxApplZone();
  864. > > MoreMasters();
  865.  
  866. // What I said
  867. > // Add the following
  868. >    InitGraf(@qd.thePort);
  869.  
  870. // What I meant
  871.    InitGraf(&qd.thePort);
  872. > > 
  873. > > AEInstallEventHandler(kCoreEventClass,kAEQuitApplication,&myQUIT,0L,0);
  874. > > 
  875. > > idletime=-1L;
  876. > > 
  877. > > do HandleEvents();
  878. > > while (!lopetus);
  879. > > }
  880.  
  881. Sorry,
  882.  
  883. Jason
  884.  
  885. _____________________________________________________________________
  886. Jason A. Bobier
  887. Prismatix Software
  888.  
  889. Email: jbobier@cybernetics.net
  890.  
  891. "Living is easy with eyes closed..."  - The Beatles
  892.  
  893. +++++++++++++++++++++++++++
  894.  
  895. >From here@there (Somone)
  896. Date: 17 Nov 1994 01:10:52 GMT
  897. Organization: Large Fuzzy Room
  898.  
  899. Here.  The Rez code and the C code to make the simplest possbile FBA.
  900. I took all the comments out so it wouldn't take much space in a posting, if
  901. you need parts of this explained *please* do your research and pull an FBA
  902. sample off summex or somewhere.
  903.  
  904. /* rez data */
  905. resource 'SIZE' (-1) {
  906.     reserved,
  907.     acceptSuspendResumeEvents,
  908.     reserved,
  909.     canBackground,
  910.     notMultiFinderAware,
  911.     onlyBackground,
  912.     dontGetFrontClicks,
  913.     ignoreChildDiedEvents,
  914.     not32BitCompatible,
  915.     isHighLevelEventAware,
  916.     localAndRemoteHLEvents,
  917.     notStationeryAware,
  918.     dontUseTextEditServices,
  919.     reserved,
  920.     reserved,
  921.     reserved,
  922.     50000,
  923.     50000
  924. };
  925.  
  926. /* C code */
  927. #include <Events.h>
  928. #include <AppleEvents.h>
  929. #include <QuickDraw.h>
  930. #include <GestaltEqu.h>
  931. #include <SegLoad.h>
  932. struct AEinstalls {
  933.     AEEventClass theClass;
  934.     AEEventID theEvent;
  935.     EventHandlerProcPtr theProc;
  936. };
  937. typedef struct AEinstalls AEinstalls;
  938.  
  939. Boolean gQuit = false;
  940. EventRecord ERecord;
  941. Boolean gHasAppleEvents;
  942.  
  943. main()
  944. {
  945.     InitGraf((Ptr)&qd.thePort);   
  946.      InitAEStuff();
  947.     while (gQuit == false) {
  948.         WaitNextEvent(highLevelEventMask, &ERecord, 30, 0);
  949.         if (ERecord.what == kHighLevelEvent)
  950.             DoHighLevel(&ERecord);
  951.     }
  952. }
  953.  
  954. void InitAEStuff(void)
  955. {
  956.     AEinstalls HandlersToInstall[] =  {
  957.          {
  958.             kCoreEventClass, kAEOpenApplication, AEOpenHandler
  959.         },  {
  960.             kCoreEventClass, kAEOpenDocuments, AEOpenDocHandler
  961.         },  {
  962.             kCoreEventClass, kAEQuitApplication, AEQuitHandler
  963.         },  {
  964.             kCoreEventClass, kAEPrintDocuments, AEPrintHandler
  965.         }, 
  966.     
  967.         
  968.     };
  969.     
  970.     OSErr aevtErr = noErr;
  971.     long aLong = 0;
  972.     Boolean gHasAppleEvents = false;
  973.     gHasAppleEvents = (Gestalt(gestaltAppleEventsAttr, &aLong) == noErr);
  974.     if (gHasAppleEvents) {
  975.         register qq;
  976.         for (qq = 0; qq < ((sizeof(HandlersToInstall) /
  977. sizeof(AEinstalls))); qq++) {
  978.             aevtErr = AEInstallEventHandler(HandlersToInstall[qq].theClass,
  979. HandlersToInstall[qq].theEvent,
  980.                                             HandlersToInstall[qq].theProc,
  981. 0, false);
  982.             if (aevtErr) {
  983.                 ExitToShell();                              /* just fail,
  984. baby */
  985.             }
  986.         }
  987.     } else {
  988.         ExitToShell();
  989.     }
  990. }
  991.  
  992. void DoHighLevel(EventRecord *AERecord)
  993. {
  994.     AEProcessAppleEvent(AERecord);
  995.     
  996. }
  997.  
  998. pascal OSErr AEOpenHandler(AppleEvent *messagein, AppleEvent *reply, long
  999. refIn)
  1000. {
  1001. #pragma unused (messagein,reply,refIn)
  1002.     return(noErr);
  1003. }
  1004. pascal OSErr AEOpenDocHandler(AppleEvent *messagein, AppleEvent *reply,
  1005. long refIn)
  1006. {
  1007. #pragma unused (reply, refIn,messagein)
  1008.     return(errAEEventNotHandled);
  1009. }
  1010.  
  1011. pascal OSErr AEPrintHandler(AppleEvent *messagein, AppleEvent *reply, long
  1012. refIn)
  1013. {
  1014. #pragma unused (reply,refIn,messagein)
  1015.     return(errAEEventNotHandled);
  1016. }
  1017.  
  1018. pascal OSErr AEQuitHandler(AppleEvent *messagein, AppleEvent *reply, long
  1019. refIn)
  1020. {
  1021. #pragma unused (messagein,refIn,reply)
  1022.     gQuit = true;
  1023.     return(noErr);
  1024.  
  1025. ---------------------------
  1026.  
  1027. >From euajgo@eua.ericsson.se (Joakim Grebeno)
  1028. Subject: Call PostEvent() from a TimeMgr task!
  1029. Date: 9 Nov 1994 15:38:47 GMT
  1030. Organization: Ellemtel Telecom Systems Labs, Stockholm, Sweden
  1031.  
  1032. Hi!
  1033. Would it actually be possible to do a PostEvent() from a task
  1034. (interrupt) triggered by the TimeManager, or is it forbidden?
  1035.  
  1036. I would like to:
  1037.  
  1038. 1. Setup an action to be executed at a later stage i.e. using
  1039.    InsTime() passing it a pointer to a function called A.
  1040.  
  1041. 2. When the timed action is due to be executed it passes the
  1042.    pointer to A to the main event loop using PostEvent() ['app1Evt'].
  1043.  
  1044. 3. The main event loop receives the event 'app1Evt' and calls
  1045.    function A contained in the event.
  1046.  
  1047. Would this actually be possible?
  1048.  
  1049. Thanks Joakim
  1050. -- 
  1051. A: Look! It's a blast-furnace!
  1052. B: It's a tree branch!
  1053. A: OK! I can see that now!
  1054.  
  1055. +++++++++++++++++++++++++++
  1056.  
  1057. >From Glenn L. Austin <glenn_a@efn.org>
  1058. Date: Thu, 10 Nov 1994 17:25:00 GMT
  1059. Organization: Eugene FreeNet
  1060.  
  1061. In article <39qqe7$mbp@euas20.eua.ericsson.se> Joakim Grebeno,
  1062. euajgo@eua.ericsson.se writes:
  1063. >Would it actually be possible to do a PostEvent() from a task
  1064. >(interrupt) triggered by the TimeManager, or is it forbidden?
  1065.  
  1066. PostEvent doesn't move memory, so as long as your time manager routine
  1067. doesn't move memory (a big no-no), yes, you could post an event.
  1068. //
  1069. // Glenn L. Austin
  1070. // Computer Wizard and Racing Car Driver
  1071. // Internet:  glenn_a@efn.org
  1072. //
  1073.  
  1074. +++++++++++++++++++++++++++
  1075.  
  1076. >From euajgo@eua.ericsson.se (Joakim Grebeno)
  1077. Date: 11 Nov 1994 08:14:04 GMT
  1078. Organization: Ellemtel Telecom Systems Labs, Stockholm, Sweden
  1079.  
  1080. Glenn L. Austin <glenn_a@efn.org> writes:
  1081.  
  1082. >In article <39qqe7$mbp@euas20.eua.ericsson.se> Joakim Grebeno,
  1083. >euajgo@eua.ericsson.se writes:
  1084. >>Would it actually be possible to do a PostEvent() from a task
  1085. >>(interrupt) triggered by the TimeManager, or is it forbidden?
  1086.  
  1087. >PostEvent doesn't move memory, so as long as your time manager routine
  1088. >doesn't move memory (a big no-no), yes, you could post an event.
  1089.  
  1090. Thanks! That's one problem out of the way! Furthermore I suppose that I
  1091. have to setup the my applications A5 world in the task before doing a
  1092. PostEvent()?
  1093. If this is the case I'm forced to pass two parameters to the TimeManager
  1094. task i.e the current A5 *and* the pointer to the function I want to post to
  1095. the main event loop. Could this really be done?
  1096.  
  1097. Thanks
  1098. Joakim
  1099.  
  1100. -- 
  1101. A: Look! It's a blast-furnace!
  1102. B: It's a tree branch!
  1103. A: OK! I can see that now!
  1104.  
  1105. +++++++++++++++++++++++++++
  1106.  
  1107. >From scouten@uiuc.edu (Eric Scouten)
  1108. Date: Fri, 11 Nov 1994 10:01:38 -0600
  1109. Organization: University of Illinois
  1110.  
  1111. [follow-ups redirected to comp.sys.mac.programmer.help]
  1112.  
  1113. In article <39v94c$s7h@euas20.eua.ericsson.se>, euajgo@eua.ericsson.se
  1114. (Joakim Grebeno) wrote:
  1115.  
  1116. > Thanks! That's one problem out of the way! Furthermore I suppose that I
  1117. > have to setup the my applications A5 world in the task before doing a
  1118. > PostEvent()?
  1119. > If this is the case I'm forced to pass two parameters to the TimeManager
  1120. > task i.e the current A5 *and* the pointer to the function I want to post to
  1121. > the main event loop. Could this really be done?
  1122.  
  1123. Yes, this is very easy to do. Just extend the TMTask record. You can do
  1124. something like this:
  1125.  
  1126. struct MyTMTask {
  1127.    TMTask       tm;
  1128.    long         itsA5;
  1129.    long         refCon;      // whatever your other parameter was
  1130. };
  1131.  
  1132.  
  1133. -es
  1134.  
  1135. __________________________________________________________________________
  1136. Eric Scouten <scouten@uiuc.edu> * MS Comp Sci '96, Univ of Illinois
  1137.  
  1138. IMPORTANT NOTICE TO READERS: The entire physical universe, including this
  1139. message, may one day collapse back into an infinitesimally small space.
  1140. Should another universe subsequently re-emerge, the existence of this message
  1141. cannot be guaranteed.
  1142.    -with apologies to Devine & Cohen (Absolute Zero Gravity)
  1143.  
  1144. +++++++++++++++++++++++++++
  1145.  
  1146. >From reed@medicine.wustl.edu (Thomas Reed)
  1147. Date: Thu, 10 Nov 1994 10:25:25 -0600
  1148. Organization: Washington University
  1149.  
  1150. I dunno if calling PostEvent is legal or not in that case.  However, it
  1151. sounds like for what you need, a safer method might be to have your TM
  1152. task set a certain global flag, which your main event loop constantly
  1153. checks for.  When you see the flag set, you call the function.  I use just
  1154. this method to draw a picture to the screen every 5 seconds in one of my
  1155. programs, and it works quite nicely.
  1156.  
  1157. -Thomas
  1158.  
  1159. =====================================================
  1160. Thomas Reed                     Washington University
  1161. reed@telesphere.wustl.edu           Medical School
  1162. reed@medicine.wustl.edu            Saint Louis, MO
  1163. - ---------------------------------------------------
  1164. Clothes make the man.  Naked people have little or no
  1165. influence on society.  -- Mark Twain
  1166. =====================================================
  1167.  
  1168. Opinions posted are not the opinions of Wash. U.
  1169.  
  1170. +++++++++++++++++++++++++++
  1171.  
  1172. >From bdiamand@netcom.com (Ben Diamand)
  1173. Date: Wed, 16 Nov 1994 04:04:16 GMT
  1174. Organization: NETCOM On-line Communication Services (408 261-4700 guest)
  1175.  
  1176. Joakim Grebeno (euajgo@eua.ericsson.se) wrote:
  1177. : Hi!
  1178. : Would it actually be possible to do a PostEvent() from a task
  1179. : (interrupt) triggered by the TimeManager, or is it forbidden?
  1180.  
  1181. : I would like to:
  1182.  
  1183. : 1. Setup an action to be executed at a later stage i.e. using
  1184. :    InsTime() passing it a pointer to a function called A.
  1185.  
  1186. : 2. When the timed action is due to be executed it passes the
  1187. :    pointer to A to the main event loop using PostEvent() ['app1Evt'].
  1188.  
  1189. : 3. The main event loop receives the event 'app1Evt' and calls
  1190. :    function A contained in the event.
  1191.  
  1192. : Would this actually be possible?
  1193.  
  1194. While PostEvent doesn't move/purge memory, the MacOS is not necessarily
  1195. re-entrant in this area(or almost any area)...In other words, for all
  1196. you know, someone else was calling PostEvent whem the timer went off
  1197. and was right in the middle of posting an event when you call PostEvent!
  1198.  
  1199. This _could_ be really bad...I'd go for the flag/post scheme, where you
  1200. flag a variable and then call PostEvent from within your main event loop...
  1201.  
  1202. Ben Diamand
  1203. bdiamand@netcom.com
  1204.  
  1205.  
  1206. +++++++++++++++++++++++++++
  1207.  
  1208. >From greg@cosc.canterbury.ac.nz (Greg Ewing)
  1209. Date: 17 Nov 1994 01:13:51 GMT
  1210. Organization: University of Canterbury, Christchurch, New Zealand
  1211.  
  1212.  
  1213. In article <bdiamandCzCDz5.4HB@netcom.com>, bdiamand@netcom.com (Ben Diamand) writes:
  1214. |> for all
  1215. |> you know, someone else was calling PostEvent whem the timer went off
  1216. |> and was right in the middle of posting an event when you call PostEvent!
  1217.  
  1218. It must surely be possible to post events at interrupt
  1219. time - else what do the mouse and keyboard interrupt
  1220. handlers do?
  1221.  
  1222. I suspect that PostEvent disables interrupts while it is
  1223. manipulating the event queue, in which case it would be
  1224. safe to call it at interrupt time.
  1225.  
  1226. But this is only a *guess* - attempt it at your own
  1227. risk!
  1228.  
  1229. |> Ben Diamand
  1230. |> bdiamand@netcom.com
  1231.  
  1232. Greg Ewing, Computer Science Dept, +--------------------------------------+
  1233. University of Canterbury,       | A citizen of NewZealandCorp, a      |
  1234. Christchurch, New Zealand       | wholly-owned subsidiary of Japan Inc.|
  1235. greg@cosc.canterbury.ac.nz       +--------------------------------------+
  1236.  
  1237. +++++++++++++++++++++++++++
  1238.  
  1239. >From pchang@Xenon.Stanford.EDU (The Weasel)
  1240. Date: 17 Nov 1994 19:46:35 GMT
  1241. Organization: Computer Science Department, Stanford University.
  1242.  
  1243. In article <3aeaof$brg@cantua.canterbury.ac.nz>,
  1244. Greg Ewing <greg@cosc.canterbury.ac.nz> wrote:
  1245. >In article <bdiamandCzCDz5.4HB@netcom.com>, bdiamand@netcom.com (Ben Diamand) writes:
  1246. >|> for all
  1247. >|> you know, someone else was calling PostEvent whem the timer went off
  1248. >|> and was right in the middle of posting an event when you call PostEvent!
  1249. >
  1250. >It must surely be possible to post events at interrupt
  1251. >time - else what do the mouse and keyboard interrupt
  1252. >handlers do?
  1253.  
  1254. It is possible to do. Check out PPostEvent. What you get back is the
  1255. eventqueue element, dequeue and enqueue turn off interrupts when
  1256. playing with the queues. I'm pretty sure that PostEvent is just doing
  1257. the same thing.
  1258.  
  1259. However, consider what event queue you are going to be slamming this
  1260. event into. I sort of missed the start of this discussion so I'm not
  1261. sure why you are putting the events in the queue, but you really need
  1262. to check to make sure which app is frontmost at the time as it is that
  1263. apps eventqueue that is going to be mucked with.
  1264.  
  1265. Peter
  1266.  
  1267.  
  1268.  
  1269.  
  1270. +++++++++++++++++++++++++++
  1271.  
  1272. >From bdiamand@netcom.com (Ben Diamand)
  1273. Date: Wed, 16 Nov 1994 04:04:16 GMT
  1274. Organization: NETCOM On-line Communication Services (408 261-4700 guest)
  1275.  
  1276. Joakim Grebeno (euajgo@eua.ericsson.se) wrote:
  1277. : Hi!
  1278. : Would it actually be possible to do a PostEvent() from a task
  1279. : (interrupt) triggered by the TimeManager, or is it forbidden?
  1280.  
  1281. : I would like to:
  1282.  
  1283. : 1. Setup an action to be executed at a later stage i.e. using
  1284. :    InsTime() passing it a pointer to a function called A.
  1285.  
  1286. : 2. When the timed action is due to be executed it passes the
  1287. :    pointer to A to the main event loop using PostEvent() ['app1Evt'].
  1288.  
  1289. : 3. The main event loop receives the event 'app1Evt' and calls
  1290. :    function A contained in the event.
  1291.  
  1292. : Would this actually be possible?
  1293.  
  1294. While PostEvent doesn't move/purge memory, the MacOS is not necessarily
  1295. re-entrant in this area(or almost any area)...In other words, for all
  1296. you know, someone else was calling PostEvent whem the timer went off
  1297. and was right in the middle of posting an event when you call PostEvent!
  1298.  
  1299. This _could_ be really bad...I'd go for the flag/post scheme, where you
  1300. flag a variable and then call PostEvent from within your main event loop...
  1301.  
  1302. Ben Diamand
  1303. bdiamand@netcom.com
  1304.  
  1305.  
  1306. +++++++++++++++++++++++++++
  1307.  
  1308. >From bdiamand@netcom.com (Ben Diamand)
  1309. Date: Wed, 16 Nov 1994 04:04:16 GMT
  1310. Organization: NETCOM On-line Communication Services (408 261-4700 guest)
  1311.  
  1312. Joakim Grebeno (euajgo@eua.ericsson.se) wrote:
  1313. : Hi!
  1314. : Would it actually be possible to do a PostEvent() from a task
  1315. : (interrupt) triggered by the TimeManager, or is it forbidden?
  1316.  
  1317. : I would like to:
  1318.  
  1319. : 1. Setup an action to be executed at a later stage i.e. using
  1320. :    InsTime() passing it a pointer to a function called A.
  1321.  
  1322. : 2. When the timed action is due to be executed it passes the
  1323. :    pointer to A to the main event loop using PostEvent() ['app1Evt'].
  1324.  
  1325. : 3. The main event loop receives the event 'app1Evt' and calls
  1326. :    function A contained in the event.
  1327.  
  1328. : Would this actually be possible?
  1329.  
  1330. While PostEvent doesn't move/purge memory, the MacOS is not necessarily
  1331. re-entrant in this area(or almost any area)...In other words, for all
  1332. you know, someone else was calling PostEvent whem the timer went off
  1333. and was right in the middle of posting an event when you call PostEvent!
  1334.  
  1335. This _could_ be really bad...I'd go for the flag/post scheme, where you
  1336. flag a variable and then call PostEvent from within your main event loop...
  1337.  
  1338. Ben Diamand
  1339. bdiamand@netcom.com
  1340.  
  1341.  
  1342. +++++++++++++++++++++++++++
  1343.  
  1344. >From greg@cosc.canterbury.ac.nz (Greg Ewing)
  1345. Date: 17 Nov 1994 01:13:51 GMT
  1346. Organization: University of Canterbury, Christchurch, New Zealand
  1347.  
  1348.  
  1349. In article <bdiamandCzCDz5.4HB@netcom.com>, bdiamand@netcom.com (Ben Diamand) writes:
  1350. |> for all
  1351. |> you know, someone else was calling PostEvent whem the timer went off
  1352. |> and was right in the middle of posting an event when you call PostEvent!
  1353.  
  1354. It must surely be possible to post events at interrupt
  1355. time - else what do the mouse and keyboard interrupt
  1356. handlers do?
  1357.  
  1358. I suspect that PostEvent disables interrupts while it is
  1359. manipulating the event queue, in which case it would be
  1360. safe to call it at interrupt time.
  1361.  
  1362. But this is only a *guess* - attempt it at your own
  1363. risk!
  1364.  
  1365. |> Ben Diamand
  1366. |> bdiamand@netcom.com
  1367.  
  1368. Greg Ewing, Computer Science Dept, +--------------------------------------+
  1369. University of Canterbury,       | A citizen of NewZealandCorp, a      |
  1370. Christchurch, New Zealand       | wholly-owned subsidiary of Japan Inc.|
  1371. greg@cosc.canterbury.ac.nz       +--------------------------------------+
  1372.  
  1373. +++++++++++++++++++++++++++
  1374.  
  1375. >From pchang@Xenon.Stanford.EDU (The Weasel)
  1376. Date: 17 Nov 1994 19:46:35 GMT
  1377. Organization: Computer Science Department, Stanford University.
  1378.  
  1379. In article <3aeaof$brg@cantua.canterbury.ac.nz>,
  1380. Greg Ewing <greg@cosc.canterbury.ac.nz> wrote:
  1381. >In article <bdiamandCzCDz5.4HB@netcom.com>, bdiamand@netcom.com (Ben Diamand) writes:
  1382. >|> for all
  1383. >|> you know, someone else was calling PostEvent whem the timer went off
  1384. >|> and was right in the middle of posting an event when you call PostEvent!
  1385. >
  1386. >It must surely be possible to post events at interrupt
  1387. >time - else what do the mouse and keyboard interrupt
  1388. >handlers do?
  1389.  
  1390. It is possible to do. Check out PPostEvent. What you get back is the
  1391. eventqueue element, dequeue and enqueue turn off interrupts when
  1392. playing with the queues. I'm pretty sure that PostEvent is just doing
  1393. the same thing.
  1394.  
  1395. However, consider what event queue you are going to be slamming this
  1396. event into. I sort of missed the start of this discussion so I'm not
  1397. sure why you are putting the events in the queue, but you really need
  1398. to check to make sure which app is frontmost at the time as it is that
  1399. apps eventqueue that is going to be mucked with.
  1400.  
  1401. Peter
  1402.  
  1403.  
  1404.  
  1405.  
  1406. +++++++++++++++++++++++++++
  1407.  
  1408. >From gspnx@di.unito.it (Fabrizio Oddone)
  1409. Date: Thu, 17 Nov 1994 15:42:41 +0100
  1410. Organization: Politecnico di Torino - Italy
  1411.  
  1412. In article <bdiamandCzCDz5.4HB@netcom.com>, bdiamand@netcom.com (Ben
  1413. Diamand) wrote:
  1414.  
  1415. > Joakim Grebeno (euajgo@eua.ericsson.se) wrote:
  1416. > : I would like to:
  1417. > : 1. Setup an action to be executed at a later stage i.e. using
  1418. > :    InsTime() passing it a pointer to a function called A.
  1419. > : 2. When the timed action is due to be executed it passes the
  1420. > :    pointer to A to the main event loop using PostEvent() ['app1Evt'].
  1421. > : 3. The main event loop receives the event 'app1Evt' and calls
  1422. > :    function A contained in the event.
  1423.  
  1424. Also, PostEvent() posts the event to the frontmost application, not
  1425. necessarily to your app, because there is a single event queue for all the
  1426. running apps.
  1427.  
  1428. So forget the appXEvt stuff and take a look at the Notification Manager...
  1429.  
  1430. -- 
  1431. Fabrizio Oddone
  1432. gspnx@di.unito.it
  1433.  
  1434. ---------------------------
  1435.  
  1436. >From Travis Peckham <travis@mirna.together.uvm.edu>
  1437. Subject: OSACompile and OSAExecute
  1438. Date: Thu, 17 Nov 1994 17:01:45 GMT
  1439. Organization: EMBA Computer Facility, University of Vermont
  1440.  
  1441. Hi All,
  1442.  
  1443. I was reading the comp.sys.mac.programmer FAQ (trying to get up to
  1444. speed on AppleEvents and AppleScript) 
  1445.  
  1446. I found this:
  1447.  
  1448. >5.2) Q:Can I compile and run scripts from my application?
  1449.  
  1450. >A: Yes, this is very simple. There are toolbox calls for reading
  1451. >scripts, compiling scripts and executing scripts. (OSACompile,
  1452. >OSAExecute)...
  1453.  
  1454. Does anyone know of some example source code which uses these calls 
  1455. to compile and execute an AppleScript? I'd be greatful.
  1456.  
  1457. Thanks!
  1458.  
  1459. Travis
  1460.  
  1461. +++++++++++++++++++++++++++
  1462.  
  1463. >From jeremy@dewey.soe.berkeley.edu (Jeremy Roschelle)
  1464. Date: Fri, 18 Nov 1994 09:42:05 -0800
  1465. Organization: SimCalc Project
  1466.  
  1467. In article <1994Nov17.170145.5835@emba.uvm.edu>, Travis Peckham
  1468. <travis@mirna.together.uvm.edu> wrote:
  1469.  
  1470. > Does anyone know of some example source code which uses these calls 
  1471. > to compile and execute an AppleScript? I'd be greatful.
  1472.  
  1473. here are two snippets (CodeWarrior C++) that should get you started:
  1474.  
  1475. OSErr 
  1476. SCScriptEditor::CompileScript()
  1477. {
  1478.    OSErr err;
  1479.    AEDesc   scriptText = {typeChar,nil};
  1480.    
  1481.    // get the text we want to compile
  1482.    scriptText.dataHandle = mTextEdit->GetTextHandle();
  1483.    err = ::OSACompile(GetScriptingComponent(),
  1484.                   &scriptText,
  1485.                   kOSAModeNull,
  1486.                   &mScriptID);
  1487.    mCompiledOK = (err == noErr);
  1488.    return err;
  1489. }
  1490.  
  1491. // this executes a script that was previously loaded (with the resulting ID)
  1492. void
  1493. ExecuteScript(ComponentInstance inScriptingComponent, OSAID inScriptID)
  1494. {
  1495.    OSAID       resultID;
  1496.    
  1497.   
  1498. OSAExecute(inScriptingComponent,inScriptID,kOSANullScript,kOSAModeNull,&resultID);
  1499.    OSADispose(inScriptingComponent,resultID);
  1500. }
  1501.  
  1502. The first snippet stores the script ID in the member variable mScriptID.
  1503. You would pass this ID to the Execute function.
  1504.  
  1505. // this will get you a scripting component:
  1506.  
  1507.    scriptingComponent = OpenDefaultComponent(kOSAComponentType,'scpt');
  1508.  
  1509. good luck,
  1510.  
  1511.  Jeremy Roschelle
  1512. [-------*--------] SimCalc Project
  1513. [------*-*-------] 4104 24th Street #344
  1514. [-------*--------] San Francisco CA 94114
  1515.  
  1516. +++++++++++++++++++++++++++
  1517.  
  1518. >From Jens Alfke <jens_alfke@powertalk.apple.com>
  1519. Date: Fri, 18 Nov 1994 22:02:16 GMT
  1520. Organization: Apple Computer
  1521.  
  1522. Travis Peckham, travis@mirna.together.uvm.edu writes:
  1523. > Does anyone know of some example source code which uses these calls 
  1524. > to compile and execute an AppleScript? I'd be greatful.
  1525.  
  1526. There's a good article by Paul Smith in a recent issue of 'develop' (17?)
  1527. that illustrates this and much more. I don't know the exact issue number
  1528. offhand, but each one includes all the back issues on CD-ROM so you can find
  1529. it if you get the latest issue.
  1530.  
  1531. --Jens Alfke                           jens_alfke@powertalk.apple.com
  1532.                    "A man, a plan, a yam, a can of Spam ... Bananama!"
  1533.  
  1534. ---------------------------
  1535.  
  1536. >From ttyab@vaal.cpr.upenn.edu ()
  1537. Subject: PBCatSearch finder flags?
  1538. Date: 8 Nov 1994 21:12:16 GMT
  1539. Organization: University of Pennsylvania
  1540.  
  1541. Hi,
  1542.     I am trying to use PBCatSearch to search for files
  1543. and EXCLUDE alias files.  The search is already working with
  1544. the ioNamePtr and ioFlAttrib flags and I would like to add
  1545. whatever it takes to make the search exclude aliases.
  1546.  
  1547.     If a file is an alias, then ioFlFndrInfo.fdFlags will
  1548. have bit 15 set (0x8000).  Ok, well, in the CInfoPBRec search1
  1549. do I set ioFlFndrInfo.fdFlags = 0x0FFF??? (I don't care what the
  1550. other 14 bits are) and then set search2 to 0xF000?
  1551.  
  1552.     (Search2 is "the mask").  Basically I don't know how
  1553. to set the target and mask to include files with bit 15 == 0.
  1554. Can some kind soul offer a solution?  
  1555.  
  1556. THanks!
  1557. .
  1558.  
  1559.  
  1560. +++++++++++++++++++++++++++
  1561.  
  1562. >From jumplong@aol.com (Jump Long)
  1563. Date: 17 Nov 1994 03:10:07 -0500
  1564. Organization: America Online, Inc. (1-800-827-6364)
  1565.  
  1566. In article <39opjg$bfm@netnews.upenn.edu>, ttyab@vaal.cpr.upenn.edu ()
  1567. writes:
  1568.  
  1569. >Basically I don't know how to set the target and mask to include files
  1570. >with bit 15 == 0. Can some kind soul offer a solution?
  1571.  
  1572. This will do it for you.
  1573.  
  1574. /* find files with alias bit clear */
  1575. searchInfo1.hFileInfo.ioFlFndrInfo.fdFlags = 0x0000; /* match when alias
  1576. bit is clear */
  1577. searchInfo2.hFileInfo.ioFlFndrInfo.fdFlags = 0x8000; /* we're interested
  1578. only in the alias bit */
  1579.  
  1580. Make sure you clear out the rest of the finder info record in both
  1581. searchInfo1 and searchInfo2, and set the fsSBFlFndrInfo search bit.
  1582.  
  1583. - Jim Luther
  1584.  
  1585.  
  1586. ---------------------------
  1587.  
  1588. >From gg110@cus.cam.ac.uk (G. Gavazzi)
  1589. Subject: Q: SICompletionUPP
  1590. Date: 16 Nov 1994 01:30:09 GMT
  1591. Organization: University of Cambridge, England
  1592.  
  1593. hi,
  1594. I am trying to make an asynchronous sound recording (to memory)
  1595. and I cannot figure out how to pass the address of my completionRoutine
  1596. (and interruptRoutine as well). My program keeps on crashing when
  1597. it calls SPBRecord(myinParamPtr,TRUE) since I put in myinParamPtr
  1598. the routines addresses.
  1599. I use:
  1600. SICompletionUPP                mycompletionRoutine(SPBPtr);
  1601. SIInterruptUPP                myinterruptRoutine(void);    
  1602. main(){
  1603. SICompletionUPP                mycompletionRoutine(SPBPtr);
  1604. SIInterruptUPP                myinterruptRoutine(void);       
  1605. ...
  1606. myinParam.completionRoutine = (SICompletionUPP)mycompletionRoutine;
  1607. myinParam.interruptRoutine = (SIInterruptUPP)myinterruptRoutine;
  1608.  
  1609. }
  1610. SICompletionUPP    mycompletionRoutine(SPBPtr inParamPtr)
  1611. {
  1612. operations on a buffer whose pointer is passed in myinParamPtr->userLong
  1613. no return value
  1614. }
  1615. SIInterruptUPP                myinterruptRoutine(void){}
  1616. I don't need to do anything when the input device is full, I could indeed
  1617. put myinParam.interruptRoutine = 0; above.
  1618.  
  1619. If I put both routines fields in myinParam = 0 my program does not
  1620. crash, it simply does not know when it's buffer is full of data.
  1621. Can anybody point me to the (C please) solution? (yes, I am going
  1622. to buy NIM on CD if it is affordable).
  1623. Thank you,
  1624. Giuliano Gavazzi
  1625.  
  1626. +++++++++++++++++++++++++++
  1627.  
  1628. >From chris-b@cs.auckland.ac.nz (Chris Burns)
  1629. Date: Thu, 17 Nov 1994 00:40:45 +1200
  1630. Organization: AucklandUniversity:ComputerScience:HMU
  1631.  
  1632. In article <3abnb1$83j@lyra.csx.cam.ac.uk>, gg110@cus.cam.ac.uk (G.
  1633. Gavazzi) wrote:
  1634.  
  1635. > I am trying to make an asynchronous sound recording (to memory)
  1636. > and I cannot figure out how to pass the address of my completionRoutine
  1637. > (and interruptRoutine as well). My program keeps on crashing when
  1638. > it calls SPBRecord(myinParamPtr,TRUE) since I put in myinParamPtr
  1639. > the routines addresses.
  1640. > I use:
  1641. > SICompletionUPP                         mycompletionRoutine(SPBPtr);
  1642. > SIInterruptUPP                          myinterruptRoutine(void);       
  1643. > main(){
  1644. > SICompletionUPP                         mycompletionRoutine(SPBPtr);
  1645. > SIInterruptUPP                          myinterruptRoutine(void);       
  1646. > ...
  1647. > myinParam.completionRoutine = (SICompletionUPP)mycompletionRoutine;
  1648. > myinParam.interruptRoutine = (SIInterruptUPP)myinterruptRoutine;
  1649. > }
  1650. > SICompletionUPP mycompletionRoutine(SPBPtr inParamPtr)
  1651. > {
  1652. > operations on a buffer whose pointer is passed in myinParamPtr->userLong
  1653. > no return value
  1654. > }
  1655. > SIInterruptUPP                          myinterruptRoutine(void){}
  1656. > I don't need to do anything when the input device is full, I could indeed
  1657. > put myinParam.interruptRoutine = 0; above.
  1658. > If I put both routines fields in myinParam = 0 my program does not
  1659. > crash, it simply does not know when it's buffer is full of data.
  1660.  
  1661.  
  1662.  
  1663.  
  1664. Here's some code I whipped up the other day to do almost exactly this:
  1665. The    #pragma parameter    bit was necessary to tell the 68K compiler
  1666. where the parameters are stashed on entry in 68K mode.
  1667.  
  1668. ///////////////////////////////////////////////////////////////////////////////
  1669. // Chris Burns 1994
  1670. ///////////////////////////////////////////////////////////////////////////////
  1671.  
  1672. #include <SoundInput.h>
  1673.  
  1674. static Boolean FailOSErr(OSErr ErrNum,Str255 ErrMsgStr);
  1675. static pascal void MyInterruptProc (SPBPtr PB,Ptr DataBuffer,short
  1676. PeakAmplitude,long SampleSize);
  1677.  
  1678. ///////////////////////////////////////////////////////////////////////////////
  1679.  
  1680. static Boolean FailOSErr(OSErr ErrNum,Str255 ErrMsgStr)
  1681. {
  1682.     if (ErrNum != noErr)
  1683.     {
  1684.     Str255          ErrStr;
  1685.     short           ErrMsgBytes;
  1686.     short           Extra;
  1687.  
  1688.         NumToString(ErrNum,ErrStr);
  1689.  
  1690.         ErrMsgBytes = ErrMsgStr[0];
  1691.         Extra = 0;
  1692.         if ((ErrMsgBytes + 1 + ErrStr[0] + 1) > 255)
  1693.         {
  1694.             ErrMsgBytes = 255 - (2 + ErrStr[0] + 1);
  1695.             ErrStr[1 + ErrStr[0] + 1] = 'ä';
  1696.             Extra = 1;
  1697.         }
  1698.  
  1699.         BlockMove(&ErrStr[1],&ErrStr[1 + ErrMsgBytes + Extra + 1],ErrStr[0]);
  1700.         BlockMove(&ErrMsgStr[1],&ErrStr[1],ErrMsgBytes);
  1701.  
  1702.         ErrStr[ErrMsgBytes + 1 + Extra] = '[';
  1703.         ErrStr[ErrMsgBytes + Extra + 1 + ErrStr[0] + 1] = ']';
  1704.         ErrStr[0] = ErrMsgBytes + Extra + 1 + ErrStr[0] + 1;
  1705.  
  1706.         DebugStr(ErrStr);
  1707.         return(true);
  1708.     }
  1709.     return(false);
  1710. }
  1711.  
  1712. ///////////////////////////////////////////////////////////////////////////////
  1713.  
  1714. #if !USESROUTINEDESCRIPTORS
  1715. #pragma parameter MyInterruptProc(__A0,__A1,__D0,__D1)
  1716. #endif
  1717.  
  1718. static pascal void MyInterruptProc (SPBPtr PB,Ptr DataBuffer,short
  1719. PeakAmplitude,long SampleSize)
  1720. {
  1721. #if !USESROUTINEDESCRIPTORS
  1722. long    SavedA5 = SetA5((*PB).userLong);
  1723. #endif
  1724.  
  1725.  
  1726.  
  1727.  
  1728.  
  1729.  
  1730. #if !USESROUTINEDESCRIPTORS
  1731.     SetA5(SavedA5);
  1732. #endif
  1733. }
  1734.  
  1735. ///////////////////////////////////////////////////////////////////////////////
  1736.  
  1737. void main (void)
  1738. {
  1739. OSErr               Err;
  1740. long                SIRefNum;
  1741. UniversalProcPtr    MyInterruptProcUPP = NewSIInterruptProc(MyInterruptProc);
  1742. SPB                 PB;
  1743. Boolean             Recording;
  1744.  
  1745.     Err = SPBOpenDevice("\p",siWritePermission,&SIRefNum);
  1746.     if (FailOSErr(Err,"\p FAILED"))
  1747.     {
  1748.     }
  1749.  
  1750. // Set up recording parameters (rate, sample size, stereo etc) here
  1751.  
  1752.     PB.inRefNum = SIRefNum;
  1753.     PB.bufferPtr = nil;
  1754.     PB.completionRoutine = nil;
  1755.     PB.interruptRoutine = MyInterruptProcUPP;
  1756.  
  1757. #if !USESROUTINEDESCRIPTORS
  1758.     PB.userLong = SetCurrentA5();
  1759. #endif
  1760.  
  1761.     Err = SPBRecord((SPBPtr)&PB,true);
  1762.     if (FailOSErr(Err,"\p FAILED"))
  1763.     {
  1764.     }
  1765.  
  1766.     Recording = true;
  1767.  
  1768.     while (Recording)
  1769.     {
  1770.         Recording = !Button();
  1771.     }
  1772.  
  1773.     Err = SPBStopRecording(SIRefNum);
  1774.     if (FailOSErr(Err,"\p FAILED"))
  1775.     {
  1776.     }
  1777.  
  1778.     Err = SPBCloseDevice(SIRefNum);
  1779.     if (FailOSErr(Err,"\p FAILED"))
  1780.     {
  1781.     }
  1782.  
  1783. #if USESROUTINEDESCRIPTORS
  1784.     DisposeRoutineDescriptor(MyInterruptProcUPP);
  1785. #endif
  1786. }
  1787.  
  1788. ///////////////////////////////////////////////////////////////////////////////
  1789.  
  1790. Chris B
  1791. - ---------------------------------------------------------------------
  1792. NewZealand:AucklandUniversity:ComputerScience:HyperMediaUnit:ChrisBurns
  1793. Internet: chris-b@cs.auckland.ac.nz
  1794. Phone:    +64 9 373-7599 x6194
  1795. Fax:      +64 9 373-7453                         Async, therefore I am.
  1796. - ---------------------------------------------------------------------
  1797.  
  1798. ---------------------------
  1799.  
  1800. End of C.S.M.P. Digest
  1801. **********************
  1802.  
  1803.  
  1804. ˇ